package com.ftp.web;

import java.util.Date;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import com.alibaba.fastjson.JSONObject;

@RestController
@RequestMapping("user")
public class UserController {


    @RequestMapping("login")
    public JSONObject login(@RequestBody JSONObject param) {
        String username = "lili";
        Jwts.builder().setSubject(username)
                .claim("roles", "admin")
                .setIssuedAt(new Date())
                .signWith(SignatureAlgorithm.HS256, "secretkey").compact();
        return null;
    }
}
